Strip unprintables from debug log: they can cause font switching on the
authorBrion Vibber <brion@users.mediawiki.org>
Sun, 15 May 2005 06:09:40 +0000 (06:09 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Sun, 15 May 2005 06:09:40 +0000 (06:09 +0000)
terminal which is annoying.

includes/GlobalFunctions.php

index e1e9c2a..3f9026a 100644 (file)
@@ -269,6 +269,9 @@ function wfDebug( $text, $logonly = false ) {
                $wgOut->debug( $text );
        }
        if ( '' != $wgDebugLogFile && !$wgProfileOnly ) {
+               # Strip unprintables; they can switch terminal modes when binary data
+               # gets dumped, which is pretty annoying.
+               $text = preg_replace( '![\x00-\x08\x0b\x0c\x0e-\x1f]!', ' ', $text );
                @error_log( $text, 3, $wgDebugLogFile );
        }
 }